Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[이수현] 휴대폰 인증 API #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

suhyeon0921
Copy link
Member

No description provided.


/** SMS 인증 */
@Post('signin/:code')
@HttpCode(HttpStatus.OK)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상태 코드 반환을 HttpStatus 객체를 통해 반환할 수 있군요👍
저는 200, 400 이렇게 써서 보냈었는데.. 훨씬 명시적이라 좋습니다! 알아갑니다😄

Comment on lines +58 to +66
const smsCode = await this.authRepository.findOne({
where: { phone },
});

if (!smsCode || smsCode.expires < Date.now()) {
throw new UnauthorizedException(
'인증 시간이 만료되었습니다. 다시 시도해 주세요.',
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smsCode 변수를 보고 인증 번호를 가져오는 줄 알았어요! 변수명이 명시적이면 좋을 것 같아요😄

if (!smsCode || smsCode.expires < Date.now()) 에서 핸드폰 번호가 없을 때도 '인증 시간이 만료' 로 메세지가 날라가는데, 예외처리를 분리하면 좋겠다는 생각이 드네요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants